#include "Window.h"

pg1::Window::Window()
{

}
//--------------------------------------------------------------------------------
pg1::Window::~Window()
{

}
//--------------------------------------------------------------------------------
bool pg1::Window::createWindow(unsigned int uiWidth, unsigned int uiHeight, HWND & hWnd)
{
	WNDCLASS kWC;

	memset(static_cast<void *> (&kWC), 0, sizeof(WNDCLASS));
	kWC.style = CS_HREDRAW | CS_VREDRAW;
	kWC.lpfnWndProc = (WNDPROC) WndProc;
	kWC.hInstance = hints;
	kWC.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
	kWC.lpszClassName = "Engine";

	if(!RegisterClass(&kWC))
		return false;

	hWnd = CreateWindow("Engine",
						"Engine v0.1",
						WS_OVERLAPPEDWINDOW,
						CW_USEDEFAULT,
						CW_USEDEFAULT,
						uiWidth,
						uiHeight,
						NULL,
						NULL,
						hints,
						NULL
	);

	if (!hWnd)
		return false;
	
	ShowWindow(hWnd,SW_SHOW);
	UpdateWindow(hWnd);

	return true;
}
//--------------------------------------------------------------------------------
LRESULT CALLBACK pg1::Window::WndProc(HWND hWnd, UINT message, 
						 WPARAM wParam, LPARAM lParam)

{
	switch (message) {

		case WM_DESTROY:
			PostQuitMessage(0);
			break;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
//--------------------------------------------------------------------------------
